<?php

function relations_add($leftType, $leftId, $rightType, $rightId, $relationType = 'parent') {
  $query = "
    INSERT INTO `relations` (`leftType`, `leftId`, `rightType`, `rightId`, `relationType`)
    VALUES('$leftType', $leftId, '$rightType', $rightId, '$relationType')
  ";  
  
  $result = database_query($query);
}

function relations_remove($leftType, $leftId, $rightType, $rightId) {
  $query  = "DELETE FROM `relations` WHERE leftType='$leftType' AND leftId = $leftId AND rightType='$rightType' AND rightId = $rightId";
  $result = database_query($query);
}
